package com.bugly.demo;


import java.io.File;
import java.io.FileOutputStream;

import com.bugly.demo.R;

import android.app.Activity;
import android.content.Context;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.widget.TextView;

public class Demo extends Activity {
	
//	274.java.lang.ClassCastException
	
	TextView exc_text;
	
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.main);
		
		exc_text = (TextView)findViewById(R.id.exc_text);
		
		exception_274();
		
	}

	
	public void exception_274(){
		try {
			//构造一个xml数据，数据为字符串
			String xml = "<?xml version='1.0' encoding='utf-8' standalone='yes' ?><string>Find5</string>";
			//获取xml文件路径
			String preFilePath = getFilesDir().getParent() + File.separator+"shared_prefs"+File.separator+"test.xml";
			File file = new File(preFilePath);
			if (!file.exists()) {
				new File(file.getParent()).mkdirs();
			}
			//将xml数据写入文件
			FileOutputStream fileOutputStream = new FileOutputStream(file);
			fileOutputStream.write(xml.getBytes());
			fileOutputStream.close();
		} catch (Exception e) {
		}
		

		//获取SharedPreferences
		SharedPreferences preferences = getSharedPreferences("test", Context.MODE_PRIVATE);
		
	}
	
	
}